package com.yuanss.smart.framework.bean;


import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;

/**
 * @Description 请求信息的封装
 * @Date 2024/11/14 下午2:41
 * @Created by 菜到不敢run
 */
public class Request {
    /**
     * 请求方法(如GET和POST)
     */
    private String requestMethod;

    /**
     * 请求路径
     */
    private String requestPath;

    public Request(String requestMethod, String requestPath) {
        this.requestMethod = requestMethod;
        this.requestPath = requestPath;
    }

    public String getRequestMethod() {
        return requestMethod;
    }

    public String getRequestPath() {
        return requestPath;
    }

    /**
     * reflectionHashCode是通过反射得到当前对象的各个属性，
     * 然后将它们作字符串拼接(append)，最后再得到拼接后的字符串的哈希码
     */
    @Override
    public int hashCode() {
        return HashCodeBuilder.reflectionHashCode(this);
    }

    /**
     * reflectionEquals与reflectionHashCode相对应
     */
    @Override
    public boolean equals(Object obj) {
        return EqualsBuilder.reflectionEquals(this, obj);
    }
}
